import $http from '../../../servers/http';
import { Result } from '../../schema/Result';
/* 系统配置-资源池管理
---------------------------------------------------------------- */
import { LineCity, ResourcePoolInfo } from '../../schema/ResourcePool';
/**新增资源池 */
export const createResourcePool = (data: ResourcePoolInfo): Promise<any> => {
  return $http.post({
    url: '/icms/resourcesmanager/resources',
    data,
  });
};

/**删除资源池 */
export const deleteResourcePool = (id: number): Promise<Result<null>> => {
  return $http.delete({
    url: `/icms/resourcesmanager/resources/${id}`,
  });
};

/**编辑资源池 */
export const modifyResourcePool = (id: number, data: ResourcePoolInfo): Promise<Result<null>> => {
  return $http.put({
    url: `/icms/resourcesmanager/resources/${id}`,
    data,
  });
};

/**查询资源池列表 */
export const getResourcePoolList = (data: {
  pageSize: number;
  pageNo: number;
  resourceName?: string;
}): Promise<Result<ResourcePoolInfo[]>> => {
  return $http.get({
    url: '/icms/resourcesmanager/resources',
    data,
  });
};

/**获取地市列表 */
export const getLineCitysList = (): Promise<Result<LineCity[]>> => {
  return $http.get({
    url: '/icms/resourcesmanager/cities',
  });
};
